home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 33
/
Volume 33 - JOGO DISK .iso
/
Games
/
shoot_em_in.swf
/
scripts
/
DefineSprite_136
/
frame_73
/
DoAction.as
Wrap
Text File
|
2007-01-15
|
3KB
|
85 lines
function collisions()
{
lDistTrans = Math.sqrt((_Yfloor - 2.44 - vYBall) * (_Yfloor - 2.44 - vYBall) + (50 - vZBall) * (50 - vZBall));
if(ldball / 2 + ldpot / 2 >= lDistTrans and -3.66 - (ldball / 2 + ldpot / 2) < vXball and vXball < 3.66 + (ldball / 2 + ldpot / 2))
{
if(lcol1 != 1)
{
lypot = _YFloor - 2.44;
lzpot = 50;
vyslope = vYBall - lypot;
vzslope = vZBall - lzpot;
vYBall = lypot + vyslope / lDistTrans * (ldball / 2 + ldpot / 2);
vZBall = lzpot + vzslope / lDistTrans * (ldball / 2 + ldpot / 2);
lLenght = Math.sqrt(vyslope * vyslope + vzslope * vzslope);
vyslope /= lLenght;
vzslope /= lLenght;
lambda = vYVector * vyslope + vZVector * vzslope;
vYVector = 2 * lambda * vyslope - vYVector;
vZVector = 2 * lambda * vzslope - vZVector;
vYVector /= vDiv;
vZVector /= vDiv;
lcol1 = 4;
_parent.mcsounds.gotoAndPlay("hitbut");
}
}
if(0 < lcol1)
{
lcol1--;
}
lDistTrans = Math.sqrt((-3.66 - vXBall) * (-3.66 - vXBall) + (50 - vZBall) * (50 - vZBall));
if(ldball / 2 + ldpot / 2 >= lDistTrans and _YFloor - (2.44 + (ldball / 2 + ldpot / 2)) < vYball)
{
if(lcol2 != 1)
{
lxpot = -3.66;
lzpot = 50;
vxslope = vXBall - lxpot;
vzslope = vZBall - lzpot;
vXBall = lxpot + vxslope / lDistTrans * (ldball / 2 + ldpot / 2);
vZBall = lzpot + vzslope / lDistTrans * (ldball / 2 + ldpot / 2);
lLenght = Math.sqrt(vxslope * vxslope + vzslope * vzslope);
vxslope /= lLenght;
vzslope /= lLenght;
lambda = vXVector * vxslope + vZVector * vzslope;
vXVector = 2 * lambda * vxslope - vXVector;
vZVector = 2 * lambda * vzslope - vZVector;
vXVector /= vDiv;
vZVector /= vDiv;
lcol2 = 4;
_parent.mcsounds.gotoAndPlay("hitbut");
}
}
if(0 < lcol2)
{
lcol2--;
}
lDistTrans = Math.sqrt((3.66 - vXBall) * (3.66 - vXBall) + (50 - vZBall) * (50 - vZBall));
if(ldball / 2 + ldpot / 2 >= lDistTrans and _YFloor - (2.44 + (ldball / 2 + ldpot / 2)) < vYball)
{
if(lcol3 != 1)
{
lxpot = 3.66;
lzpot = 50;
vxslope = vXBall - lxpot;
vzslope = vZBall - lzpot;
vXBall = lxpot + vxslope / lDistTrans * (ldball / 2 + ldpot / 2);
vZBall = lzpot + vzslope / lDistTrans * (ldball / 2 + ldpot / 2);
lLenght = Math.sqrt(vxslope * vxslope + vzslope * vzslope);
vxslope /= lLenght;
vzslope /= lLenght;
lambda = vXVector * vxslope + vZVector * vzslope;
vXVector = 2 * lambda * vxslope - vXVector;
vZVector = 2 * lambda * vzslope - vZVector;
vXVector /= vDiv;
vZVector /= vDiv;
lcol3 = 4;
_parent.mcsounds.gotoAndPlay("hitbut");
}
}
if(0 < lcol3)
{
lcol3--;
}
}